{% extends 'generic.html' %}
{% load i18n %} {# Translating code #}

{% block cssBlock %}
	<link href="/media/css/{{request.session.theme}}/pageForm/style.css" type="text/css" rel="stylesheet"/>	
	<link href="/media/css/{{request.session.theme}}/pageProfile/style.css" type="text/css" rel="stylesheet"/>
{% endblock %}

{% block header %}
	<h1>{% blocktrans %}Parallel Platform - Account management{% endblocktrans %}</h1>
{% endblock %}

{% block article %}
<header>{% blocktrans with user.email as user_email %}{{user_email}}'s account management{% endblocktrans %}</header>

<h2>{% blocktrans %}Password{% endblocktrans %}</h2>
<p class="explanation">{% blocktrans %}Change the password to enter your account{% endblocktrans %}</p>
<form action="/accounts/password/change/" method='POST'>
	{% csrf_token %}
	{{passwordChange.non_field_errors}}
	<table>
		<tr>
			<td>
				{{passwordChange.old_password.label_tag}}:
			</td>
			<td>
				{{passwordChange.old_password}}
			</td>
			<td>
				{{passwordChange.old_password.errors}}
			</td>
		</tr>
		<tr>
			<td>
				{{passwordChange.new_password1.label_tag}}:
			</td>
			<td>
				{{passwordChange.new_password1}}
			</td>
			<td>
				{{passwordChange.new_password1.errors}}
			</td>
		</tr>
		<tr>
			<td>
				{{passwordChange.new_password2.label_tag}}
			</td>
			<td>
				{{passwordChange.new_password2}}
			</td>
			<td>
				{{passwordChange.new_password2.errors}}
			</td>
		</tr>
	
	</table>
	<input type="submit" value="{% blocktrans %}Change password{% endblocktrans %}" />
</form>

<h2>{% blocktrans %}Nickname{% endblocktrans %}</h2>
<p class="explanation">{% blocktrans with user.username as username %}Your current nick is "{{username}}", when you collaborate in pages, you will appear with this name (if you have this option activated). Keep in mind that to log in you will still need to use your e-mail address.{% endblocktrans %}</p>
<form action="/accounts/profile/" method='POST'>
	{% csrf_token %}
	{{userChange.non_field_errors}}
	<table>
		<tr>
			<td>{% blocktrans %}Current nickname{% endblocktrans %}:</td>
			<td>{{user.username}}</td>
			<td></td>
		</tr>
		<tr>
			<td>
				{% blocktrans %}New nickname{% endblocktrans %}:
			</td>
			<td>
				{{ userChange.username }}
			</td>
			<td>
				{{ userChange.username.errors }}
			</td>
		</tr>
	</table>
	<input type="hidden" name="type" value="user" />
	<input type="submit" value="{% blocktrans %}Change nickname{% endblocktrans %}" />
</form>

<h2>{% blocktrans %}Privacy options{% endblocktrans %}</h2>
<p class="explanation">{% blocktrans %}Appear as collaborator in those pages that you created or modified, unchecking this option will make all those pages to stop displaying your name as collaborator.{% endblocktrans %}</p>
<form action="/accounts/profile/" method='POST'>
	{% csrf_token %}
	<p>{% blocktrans %}Show name where I collaborated{% endblocktrans %}<input type="checkbox" name="isCollaborator"  
		{% if user.visibleContributor %}
			checked
		{% endif %}/>
		<input type="hidden" name="type" value="isContributor" />
	</p>
	<input type="submit" value="{% blocktrans %}Change privacy options{% endblocktrans %}" />
</form>

<h2>{% blocktrans %}Remove this account{% endblocktrans %}</h2>
<p class="explanation">{% blocktrans %}Are you willing to leave us? This is bad news! Anyway, you have your rights to erase all your data stored in our servers and delete this account. We only need your password to prove it is really you.{% endblocktrans %}</p>
<form action="/accounts/profile/" method='POST'>
	{% csrf_token %}
	{{removeUser.non_field_errors}}
	<table>
		<tr>
			<td>
				{% blocktrans %}Your password{% endblocktrans %}:
			</td>
			<td>
				{{ removeUser.password }}
			</td>
			<td>
				{{ removeUser.password.errors }}
			</td>
		</tr>
	</table>
	<input type="hidden" name="type" value="removeUser" />
	<input type="submit" value="{% blocktrans %}Remove user{% endblocktrans %}" />
</form>

{% endblock %}
